package com.deuwise.system.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import java.util.Date;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.deuwise.common.validator.group.AddGroup;
import com.deuwise.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;

/**
 * 
 *@author deuwise
 *@date 2018-11-06 14:15:04
 */
@Data
@EqualsAndHashCode(callSuper=true)
@TableName("sys_role")
public class SysRole extends Model<SysRole>  implements Serializable{
    /**唯一主键Id*/
    @ApiModelProperty("唯一主键Id")
    @TableField("id")
    @TableId
    private String id;

    /**角色名称*/
    @ApiModelProperty("角色名称")
    @TableField("role_name")
    @NotBlank(message ="角色名称不能为空",groups = {AddGroup.class, UpdateGroup.class})
    @Length(max =60,message ="角色名称长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String roleName;

    /**角色标识*/
    @ApiModelProperty("角色标识")
    @TableField("role_sign")
    private String roleSign;

    /**备注*/
    @ApiModelProperty("备注")
    @TableField("remark")
    @Length(max =120,message ="备注长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String remark;

    /**创建人*/
    @ApiModelProperty("创建人")
    @TableField("create_at")
    private String createAt;

    /**创建时间*/
    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private Date createTime;

    /**更新时间*/
    @ApiModelProperty("更新时间")
    @TableField("update_time")
    private Date updateTime;

    /**虚拟角色,0系统角色，1关联用户虚拟角色*/
    @ApiModelProperty("虚拟角色,0系统角色，1关联用户虚拟角色")
    @TableField("invented")
    private Integer invented;

    @ApiModelProperty("系统Id用于角色菜单授权")
    @TableField(exist = false)
    private String systemId;

    @TableField(exist = false)
    private List<String> menuIdList;

    @TableField(exist = false)
    private List<String> layerList;

   @Override
    protected Serializable pkVal() {
        return id;
    }
}